/**
 *
 */
package com.david.mydemo.framework.config;

import com.alibaba.fastjson.parser.ParserConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author My
 *
 */
@Slf4j
@Component
@Order(value = 1)
public class MetaDataInit implements ApplicationRunner {

//	@Autowired
//	private Sec_DistrictDao sec_DistrictDao;
//	@Autowired
//	private CacheManager cacheManager;

    @Override
    public void run(ApplicationArguments args) {
//		List<Sec_District> sec_Districts = sec_DistrictDao.listData();
//		Map<Integer, Sec_District> sec_Districtkv = sec_Districts.stream().collect(Collectors.toMap(Sec_District::getDistrictId, sec_District -> sec_District));
//		Cache cache = cacheManager.getCache("sysCache");
//		MetaData meta = new MetaData(sec_Districts, sec_Districtkv);
//		cache.put(new Element("meta", meta));

        // 设置FastJson安全模式开启，禁用autotype 20210414
        ParserConfig.getGlobalInstance().setSafeMode(true);

        log.info("加载元数据完毕！");
    }
}
